﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EnvironmentalMonitor.Support.Module.Environmental
{
    /// <summary>
    /// 设备
    /// </summary>
    public class Machine : EnvironmentalMonitor.Support.Module.AbstractModule
    {
        private string _RoomId;
        /// <summary>
        /// 机房编号
        /// </summary>
        public string RoomId
        {
            get
            {
                return this._RoomId;
            }
            set
            {
                this._RoomId = value;
            }
        }

        private string _Name;
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this._Name = value;
            }
        }

        private string _Ip;
        /// <summary>
        /// IP
        /// </summary>
        public string Ip
        {
            get
            {
                return this._Ip;
            }
            set
            {
                this._Ip = value;
            }
        }

        private string _Netmask;
        /// <summary>
        /// 子网掩码
        /// </summary>
        public string Netmask
        {
            get
            {
                return this._Netmask;
            }
            set
            {
                this._Netmask = value;
            }
        }

        private string _Gateway;
        /// <summary>
        /// 网关
        /// </summary>
        public string Gateway
        {
            get
            {
                return this._Gateway;
            }
            set
            {
                this._Gateway = value;
            }
        }

        private string _Mac;
        /// <summary>
        /// 物理地址
        /// </summary>
        public string Mac
        {
            get
            {
                return this._Mac;
            }
            set
            {
                this._Mac = value;
            }
        }

        private string _MobileA;
        /// <summary>
        /// 手机号码
        /// </summary>
        public string MobileA
        {
            get
            {
                return this._MobileA;
            }
            set
            {
                this._MobileA = value;
            }
        }

        private string _MobileB;
        /// <summary>
        /// 手机号码
        /// </summary>
        public string MobileB
        {
            get
            {
                return this._MobileB;
            }
            set
            {
                this._MobileB = value;
            }
        }

        private string _MobileC;
        /// <summary>
        /// 手机号码
        /// </summary>
        public string MobileC
        {
            get
            {
                return this._MobileC;
            }
            set
            {
                this._MobileC = value;
            }
        }

        private bool _Alarm;
        /// <summary>
        /// 手机报警
        /// </summary>
        public bool Alarm
        {
            get
            {
                return this._Alarm;
            }
            set
            {
                this._Alarm = value;
            }
        }

        private int _Interval;
        /// <summary>
        /// 上传数据时间间隔
        /// </summary>
        public int Interval
        {
            get
            {
                return this._Interval;
            }
            set
            {
                this._Interval = value;
            }
        }

        private string _FloorPlan;
        /// <summary>
        /// 平面图
        /// </summary>
        public string FloorPlan
        {
            get
            {
                return this._FloorPlan;
            }
            set
            {
                this._FloorPlan = value;
            }
        }

        private string _IpCache;
        /// <summary>
        /// IP缓存
        /// </summary>
        public string IpCache
        {
            get
            {
                return this._IpCache;
            }
            set
            {
                this._IpCache = value;
            }
        }

        private string _NetmaskCache;
        /// <summary>
        /// 子网掩码缓存
        /// </summary>
        public string NetmaskCache
        {
            get
            {
                return this._NetmaskCache;
            }
            set
            {
                this._NetmaskCache = value;
            }
        }

        private string _GatewayCache;
        /// <summary>
        /// 网关缓存
        /// </summary>
        public string GatewayCache
        {
            get
            {
                return this._GatewayCache;
            }
            set
            {
                this._GatewayCache = value;
            }
        }

        private string _MacCache;
        /// <summary>
        /// 物理地址缓存
        /// </summary>
        public string MacCache
        {
            get
            {
                return this._MacCache;
            }
            set
            {
                this._MacCache = value;
            }
        }

        private string _MobileACache;
        /// <summary>
        /// 手机号码缓存
        /// </summary>
        public string MobileACache
        {
            get
            {
                return this._MobileACache;
            }
            set
            {
                this._MobileACache = value;
            }
        }

        private string _MobileBCache;
        /// <summary>
        /// 手机号码缓存
        /// </summary>
        public string MobileBCache
        {
            get
            {
                return this._MobileBCache;
            }
            set
            {
                this._MobileBCache = value;
            }
        }

        private string _MobileCCache;
        /// <summary>
        /// 手机号码缓存
        /// </summary>
        public string MobileCCache
        {
            get
            {
                return this._MobileCCache;
            }
            set
            {
                this._MobileCCache = value;
            }
        }

        private bool _AlarmCache;
        /// <summary>
        /// 手机报警缓存
        /// </summary>
        public bool AlarmCache
        {
            get
            {
                return this._AlarmCache;
            }
            set
            {
                this._AlarmCache = value;
            }
        }

        private int _IntervalCache;
        /// <summary>
        /// 上传数据时间间隔缓存
        /// </summary>
        public int IntervalCache
        {
            get
            {
                return this._IntervalCache;
            }
            set
            {
                this._IntervalCache = value;
            }
        }

        private Room _Room;
        /// <summary>
        /// 机房
        /// </summary>
        public Room Room
        {
            get
            {
                return this._Room;
            }
            set
            {
                this._Room = value;
            }
        }

        /// <summary>
        /// 机房名称
        /// </summary>
        public string RoomName
        {
            get
            {
                string result = string.Empty;
                if (this.Room != null)
                {
                    result = this.Room.Name;
                }
                return result;
            }
        }

        private List<Detector> _Detectors;
        /// <summary>
        /// 探头集合
        /// </summary>
        public List<Detector> Detectors
        {
            get
            {
                return this._Detectors;
            }
            set
            {
                this._Detectors = value;
            }
        }

        public string AlarmText
        {
            get
            {
                string result = string.Empty;

                if (this._Alarm)
                {
                    result = "是";
                }
                else
                {
                    result = "否";
                }

                return result;
            }
        }

        /// <summary>
        /// 平面图链接
        /// </summary>
        public string FloorPlanHref
        {
            get
            {
                return string.Format("<a href=\"{0}{1}\" target=\"_blank\"><img src=\"{0}{1}\" height=\"128\" border=\"0\" /></a>", EnvironmentalMonitor.Support.Resource.Variable.VirtualRootPath, this._FloorPlan);
            }
        }

        public string AlarmCacheText
        {
            get
            {
                string result = string.Empty;

                if (this._AlarmCache)
                {
                    result = "是";
                }
                else
                {
                    result = "否";
                }

                return result;
            }
        }
    }
}
